#include "syscall.h"


void print(void *c)
{
    char *d=(char*)c;
    PutChar(d);
    PutChar('<');
    PutChar('\n');
  
}

void mprint(void *c){
int i=0;
char a= (char)(((int)c)/128);
int n=((int)c)-((int)a*128);
//PutInt(n);

while(i<n)  {
//PutString("Thread '");	
PutChar(a);
//PutString("' > ");
//PutInt(i+1);
//PutString("\n");
i=i+1;
}
//UserThreadExit();
}
void * concat(int i,char c){
 int a1 = (int)c;
    a1=a1*128+i;    
	return (void*)a1;
	}
int main()
{
	int tid[10];
	int i = 0;
    PutString("Lancement\n");
	tid[0] = UserThreadCreate(mprint, concat(5,'a'));
	
	tid[1] = UserThreadCreate(mprint, concat(5,'b'));
	tid[2] = UserThreadCreate(mprint, concat(5,'c'));
	tid[3] = UserThreadCreate(mprint, concat(5,'d'));
	//tid[4] = UserThreadCreate(mprint, concat(5,'e'));
	//tid[5] = UserThreadCreate(mprint, concat(5,'f'));
	//tid[6] = UserThreadCreate(mprint, concat(5,'g'));
	//tid[7] = UserThreadCreate(mprint, concat(5,'h'));
	//tid[8] = UserThreadCreate(mprint, concat(5,'i'));
	//tid[9] = UserThreadCreate(mprint, concat(5,'j'));
	/*tid[10] = UserThreadCreate(mprint, concat(5,'k'));
	tid[11] = UserThreadCreate(mprint, concat(5,'l'));
	tid[12] = UserThreadCreate(mprint, concat(5,'m'));
	tid[13] = UserThreadCreate(mprint, concat(5,'n'));
	*/
	
	UserThreadJoin(tid[0]);
	UserThreadJoin(tid[1]);
	UserThreadJoin(tid[2]);
	UserThreadJoin(tid[3]);
	/*UserThreadJoin(tid[4]);
	UserThreadJoin(tid[5]);
	UserThreadJoin(tid[6]);
	UserThreadJoin(tid[7]);
	UserThreadJoin(tid[8]);
	UserThreadJoin(9);*/
	
	//while(1);
	/*UserThreadJoin(tid[10]);
	UserThreadJoin(tid[11]);
	UserThreadJoin(tid[12]);
	UserThreadJoin(tid[13]);
	*/
//	UserThreadJoin(tid[8]);

	
}
